package me.helllp.bootman.back.logic.demo.web;

import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import me.helllp.bootman.common.base.BaseReturn;
import me.helllp.bootman.back.logic.demo.vo.*;

/**
 * 测试模块
 * 
 * @author 自动生成
 *
 */
@RestController
@RequestMapping("/user1")
@Api("测试模块")
public class MyDemoController extends me.helllp.bootman.common.base.BaseController{
	private static final Logger logger = LoggerFactory.getLogger(MyDemoController.class);
	
	@Autowired
	private me.helllp.bootman.back.logic.demo.services.MyDemoService logicService;
	
	/**
	 * 测试方法1
	 */
	@ApiOperation("测试方法1") 
	@RequestMapping(value = "/no001", method=RequestMethod.GET)
	public BaseReturn runNo001(@Valid @RequestBody No001Input input, BindingResult result){
		if (result.hasErrors()) {
			BaseReturn ret = this.genCheckResult(result);
			logger.info(ret.toString());
			return ret;
		}	
		
		return logicService.logicNo001(input);
	}
	  
	/**
	 * 测试方法2
	 */
	@ApiOperation("测试方法2") 
	@RequestMapping(value = "/no002", method=RequestMethod.POST)
	public BaseReturn runNo002(@Valid @RequestBody No002Input input, BindingResult result){
		if (result.hasErrors()) {
			BaseReturn ret = this.genCheckResult(result);
			logger.info(ret.toString());
			return ret;
		}	
		
		return logicService.logicNo002(input);
	}
	  
	/**
	 * 测试方法3
	 */
	@ApiOperation("测试方法3") 
	@RequestMapping(value = "/no003", method=RequestMethod.PUT)
	public BaseReturn runNo003(@Valid @RequestBody No003Input input, BindingResult result){
		if (result.hasErrors()) {
			BaseReturn ret = this.genCheckResult(result);
			logger.info(ret.toString());
			return ret;
		}	
		
		return logicService.logicNo003(input);
	}
	  
	/**
	 * 测试方法4
	 */
	@ApiOperation("测试方法4") 
	@RequestMapping(value = "/no004", method=RequestMethod.DELETE)
	public BaseReturn runNo004(@Valid @RequestBody No004Input input, BindingResult result){
		if (result.hasErrors()) {
			BaseReturn ret = this.genCheckResult(result);
			logger.info(ret.toString());
			return ret;
		}	
		
		return logicService.logicNo004(input);
	}
	  
}
